package com.api.rc.service;

import com.api.rc.form.CreateRoomForm;
import com.api.rc.form.GameResultForm;
import com.api.rc.vo.PlayerVo;
import com.api.rc.vo.RcOverviewVo;
import com.api.rc.vo.RoomVo;
import com.api.user.exception.CoinChangedException;
import com.github.pagehelper.PageInfo;

import java.util.List;
import java.util.Map;

/**
 * @author RenQiang
 * @date 2021/7/12
 */
public interface RapidChallengeService {
    /**
     * 创建房间
     *
     * @param userId
     * @param createRoomForm
     */
    void createRoom(Long userId, CreateRoomForm createRoomForm);

    /**
     * 开始游侠
     *
     * @param roomId
     * @throws CoinChangedException
     */
    void startGame(Long roomId) throws CoinChangedException;

    /**
     * 校验房间密码
     *
     * @param roomId
     * @param password
     * @return
     */
    boolean checkRoomPassword(Long roomId, String password);

    /**
     * 分页查询房间
     *
     * @param queryParams
     * @param page
     * @param size
     * @return
     */
    PageInfo<RoomVo> listByPage(Map<String, Object> queryParams, Integer page, Integer size);

    /**
     * 结束游戏并保存游戏结果
     *
     * @param gameResultForm
     */
    void completeGame(GameResultForm gameResultForm) throws CoinChangedException;

    /**
     * 获取比赛结果
     *
     * @param roomId
     * @return
     */
    GameResultForm getGameResult(Long roomId);

    /**
     * 确认比赛结果并给主持人打分
     *
     * @param userId
     * @param roomId
     * @param starToHost
     */
    void confirmGameResult(Long userId, Long roomId, Integer starToHost);

    /**
     * 获取总览
     *
     * @return
     */
    RcOverviewVo getOverview();

    /**
     * 获取玩家详情
     *
     * @param roomId
     * @return
     */
    List<PlayerVo> getPlayerDetail(Long roomId);
}
